package com.example.coupon.feign.hystrix;

import com.example.coupon.feign.TemplateClient;
import com.example.coupon.vo.CommonResponse;
import com.example.coupon.vo.CouponTemplateSDK;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.*;

/**
 * 优惠券模版 Feign接口的熔断降级策略
 * @author wangbo
 * @description:
 * @date 2021/2/1914:31
 */
@Slf4j
@Component
public class TemplateClientHystrix implements TemplateClient {

    @Override
    public CommonResponse<List<CouponTemplateSDK>> findAllUsableTemplate() {
        log.error("[eureka-client-coupon-template] findAllUsableTemplate request error");
        return new CommonResponse<>(-1,"[eureka-client-coupon-template] findAllUsableTemplate request error", Collections.EMPTY_LIST);
    }

    @Override
    public CommonResponse<Map<Integer, CouponTemplateSDK>> findIds2TemplateSDK(Collection<Integer> ids) {
        log.error("[eureka-client-coupon-template] findIds2TemplateSDK request error");
        return new CommonResponse<>(-1,"[eureka-client-coupon-template] findIds2TemplateSDK request error",new HashMap<>());
    }
}
